﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Emgu.CV;

namespace TagPropagator
{
    public class Comparer : IComparer
    {
        public double Compare(Node firstNode, Node secondNode)
        {
            double cor = 1;
            for (int i = 0; i < 3; i++)
            {
                var h1 = firstNode.Features["histogram" + i].Data as DenseHistogram;
                var h2 = secondNode.Features["histogram" + i].Data as DenseHistogram;
                double c = CvInvoke.cvCompareHist(h1, h2, Emgu.CV.CvEnum.HISTOGRAM_COMP_METHOD.CV_COMP_CORREL);
                cor *= c;
            }
            return cor;
        }
    }
}
